]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
swipeTracker: Handle touchpad gestures on actor
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 9 Dec 2025 13:33:38 +0000 (14:33 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 14 Jan 2026 18:10:43 +0000 (19:10 +0100)
Touchscreen gestures and scrolling are already handled by events
on the associated actor rather than the stage. There's no good
reason to not do the same for touchpad gestures as well.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8850
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3997>
(cherry picked from commit 006cef5a687814a5560a564811b16e76430291fc)

js/ui/swipeTracker.js

index 950f2a6c120619086a7d0bef79bf7394aaa7d534..1bf66b06a9f5b7fa08d4091df2d61194ac9aa972 100644 (file)
@@ -103,7 +103,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
         'end':    {param_types: [GObject.TYPE_UINT, GObject.TYPE_DOUBLE]},
     },
 }, class TouchpadSwipeGesture extends GObject.Object {
-    _init(allowedModes) {
+    _init(actor, allowedModes) {
         super._init();
         this._allowedModes = allowedModes;
         this._state = TouchpadState.NONE;
@@ -113,8 +113,8 @@ const TouchpadSwipeGesture = GObject.registerClass({
             schema_id: 'org.gnome.desktop.peripherals.touchpad',
         });
 
-        global.stage.connectObject(
-            'captured-event::touchpad', this._handleEvent.bind(this), this);
+        actor.connectObject(
+            'event::touchpad', this._handleEvent.bind(this), this);
     }
 
     _handleEvent(actor, event) {
@@ -405,7 +405,7 @@ export const SwipeTracker = GObject.registerClass({
             null);
         actor.add_action_full(params.name, params.phase, this._panGesture);
 
-        this._touchpadGesture = new TouchpadSwipeGesture(allowedModes);
+        this._touchpadGesture = new TouchpadSwipeGesture(actor, allowedModes);
         this._touchpadGesture.connect('begin', this._beginTouchpadGesture.bind(this));
         this._touchpadGesture.connect('update', this._updateTouchpadGesture.bind(this));
         this._touchpadGesture.connect('end', this._endTouchpadGesture.bind(this));